import { Controller, Get } from '@nestjs/common';
import { MockCatsService } from './mockCats.service';
import { ConfigService } from '@nestjs/config';

@Controller('cats')
export class MockCatsController {
  constructor(
    private mockCatsService: MockCatsService,
    private configService: ConfigService,
  ) {}

  @Get('mock')
  getMock() {
    // get an environment variable
    const dbUser = this.configService.get<string>('DATABASE_USER');
    console.log('dbUser', dbUser);

    // get a custom configuration value
    const DATABASE_PASSWORD =
      this.configService.get<string>('DATABASE_PASSWORD');
    console.log('DATABASE_PASSWORD', DATABASE_PASSWORD);

    console.log('走进了这个控制器方法');
    return (this.mockCatsService as any).data;
  }
}
